<template>
  <el-container
    class="main-wrap"
    :class="{ black_main: $route.path == '/cameraPlay' }"
  >
    <el-aside :class="[collapase ? 'hideMenu' : 'showMenu']">
      <Menu :collapase="collapase" />
    </el-aside>
    <el-container class="el-container-r">
      <el-header :class="[collapase ? 'headerWrapHide' : 'headerWrapShow']">
        <Header
          :class="[
            $route.path == '/cameraPlay' || $route.path == '/videoRecord'
              ? 'black'
              : '',
          ]"
          @toggle="fnToggle"
        />
      </el-header>
      <el-main :class="[collapase ? 'mainWrapHide' : 'mainWrapShow']">
        <!-- 先注释掉，已浏览过的页面的记录 -->
        <!-- <TagViews ref="tab" :class="[collapase?'tagWrapHide':'tagWrapShow']" /> -->
        <div class="routeWrap">
          <transition name="fade-transform" mode="out-in">
            <router-view :key="$route.fullPath" />
          </transition>
        </div>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import Header from "./../components/common/Header";
// import HeaderBlack from "./../components/common/HeaderBlack";
import Menu from "./../components/common/Menu";
// import TagViews from "./../components/common/TagViews";
export default {
  name: "Main",
  data() {
    return {
      collapase: false,
    };
  },
  methods: {
    fnToggle(val) {
      this.collapase = val;
    },
  },
  components: {
    Menu,
    Header,
    // TagViews
  },
  computed: {
    classObject: function () {
      return {
        active:
          $route.path == "/cameraPlay" || $route.path == "/videoRecord"
            ? "black"
            : "",
      };
    },
  },
};
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
#app {
  width: 100%;
  height: auto;
  overflow: hidden;
}

.main-wrap {
  display: flex;
  justify-content: flex-start !important;
}
.black_main {
  background: rgb(48, 65, 86);
}
.el-container-r {
  width: 100%;
  height: auto;
  overflow: hidden;
}
.routeWrap {
  width: 100%;
  height: auto;
  min-height: calc(100vh - 60px);
  overflow-y: hidden;
  overflow-x: hidden;
  background: #f0f3f4;
  padding: 20px;
  box-sizing: border-box;
  /* margin-top: 109px; */
  margin-top: 60px;
}
.mainWrapShow {
  width: calc(100% - 200px);
  margin-left: 200px;
  transition: all linear 0.3s;
}
.mainWrapHide {
  width: calc(100% - 64px);
  margin-left: 64px;
  transition: all linear 0.3s;
}
.headerWrapHide {
  width: calc(100% - 64px);
  position: fixed;
  left: 64px;
  top: 0;
  transition: all linear 0.3s;
  z-index: 999;
}
.headerWrapShow {
  width: calc(100% - 200px);
  position: fixed;
  left: 200px;
  top: 0;
  transition: all linear 0.3s;
  z-index: 999;
}
.tagWrapHide {
  width: calc(100% - 64px);
  position: fixed;
  left: 64px;
  top: 60px;
  transition: all linear 0.3s;
  z-index: 999;
  height: 49px;
}
.tagWrapShow {
  width: calc(100% - 200px);
  position: fixed;
  top: 67px;
  -webkit-transition: all linear 0.3s;
  transition: all linear 0.3s;
  z-index: 999;
  height: 49px;
  padding-left: 20px;
}
.hideMenu {
  width: 64px !important;
  transition: all linear 0.3s;
  position: fixed;
  left: 0;
  top: 0;
}
.showMenu {
  width: 200px !important;
  transition: all linear 0.3s;
  position: fixed;
  left: 0;
  top: 0;
}

.el-main {
  padding: 0 !important;
}
.router-tab__container {
  padding: 20px !important;
}
.fade-transform-leave-active,
.fade-transform-enter-active {
  transition: all 0.5s;
}

.fade-transform-enter {
  opacity: 0;
  transform: translateX(-30px);
}

.fade-transform-leave-to {
  opacity: 0;
  transform: translateX(30px);
}
</style>
